/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.jome.ctrlview.bidim.selection.events;

/**
 *
 * @author Mr.Sam
 */
import java.util.EventObject;

/**
* The event to send to all objects that implements the interface SlectionEventListener
* and which want to maintain a list of selected elements.
*
* @author © 1998 DIRAT Laurent
* @version 1.0  30/06/98
*/
public class SelectionEvent extends EventObject {
    /**
    * The action to execute by sending the event.
    */
    private int action;

    /**
    * The object which has been selected.
    */
    private Object argument;

    /**
    * The constructor.
    * @param src the object which produces this event.
    */
    public SelectionEvent(Object src) {
        super(src);
    }

    /**
    * Sets the action to execute and its argument.
    * @param action the action.
    * @param argument the argument.<BR>
    * In the case of the actions GET_SELECTION and GET_SELECTION_SIZE,
    * arguments will serve as well as the return value
    */
    public void setAction(int action, Object argument) {
        this.action = action;
        this.argument = argument;
    }

    /**
    * Returns the action associated with the event.
    */
    public int getAction() {
        return action;
    }

    /**
    * Returns the action argument.
    */
    public Object getArgument() {
        return argument;
    }
    
    /**
    * Sets the action argument.
    * @param argument the action argument.
    */
    public void setArgument(Object argument) {
        this.argument = argument;
    }

    /**
    * The different actions associated with the event.<BR>
    */

    /**
    * This action tells the selections manager to remove all the elements it has.
    */
    public static final int PURGE               = 0;

    /**
    * This action tells the selections manager to remove an element. (which will be
    * given to him)
    */
    public static final int REMOVE              = 1;

    /**
    * This action tells the selections manager to add an element. (which will be
    * given to him)
    */
    public static final int ADD                 = 2;

    /**
    * This action tells the selections manager to give the number of selected 
    * elements
    */
    public static final int GET_SELECTION_SIZE  = 3;

    /**
    * This action tells the selections manager to give all the selected elements
    */
    public static final int GET_SELECTION       = 4;

    /**
    * For debugg only. To list all the selected elements.
    */
    public static final int LIST                = 10;
}
